home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-11-13 | 1.2 KB | 66 lines | [TEXT/AKu?] |
- property kasSize : {128, 128}
- property kasScale : {4, 4}
- property kasName : "MouseTrap"
- property kasRefreshInterval : 1
-
- global gasDrawWin
- global gdx, gdy
- global gasPos
-
-
- on run
- pfLoad()
-
- set gasDrawWin to ¬
- display drawing titled kasName ¬
- with dimensions kasSize ¬
- located at gasPos
-
- set gdx to (item 1 of kasSize) / 2 / (item 1 of kasScale)
- set gdy to (item 2 of kasSize) / 2 / (item 2 of kasScale)
-
- idle
- end run
-
-
- on idle
- -- Find mouse
- set mPos to pointer location of (input state)
- set mBox to {(item 1 of mPos) - gdx, (item 2 of mPos) - gdy, (item 1 of mPos) + gdx, (item 2 of mPos) + gdy}
-
- -- Get picture
- set mPic to capture picture inside of mBox
-
- -- Draw it (don't need scale parameter, since we are using "inside of" to scale to full window)
- draw a picture into gasDrawWin ¬
- using data mPic ¬
- inside of {0, 0, item 1 of kasSize, item 2 of kasSize} ¬
- without recording
-
- return kasRefreshInterval
- end idle
-
-
- on quit
- set gasPos to screen location of ¬
- (display drawing gasDrawWin with disposal)
-
- pfSave()
-
- return (continue quit)
- end quit
-
-
- on pfLoad()
- try
- set gasPos to load preference named kasName
- on error
- set gasPos to {-1, -1}
- end try
- end pfLoad
-
-
- on pfSave()
- save preference gasPos named kasName
- end pfSave
-